home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / dev / misc / ImageFXDevKit.lha / sdev / include / scan / ged.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-21  |  12.3 KB  |  316 lines

  1. /*
  2.  * Scan 'C' Header File
  3.  * Written by Thomas Krehbiel
  4.  *
  5.  * Ged GUI system.
  6.  *
  7.  */
  8.  
  9. #ifndef SCAN_GED_H
  10.  
  11.  
  12. #ifndef EXEC_TYPES_H
  13. #include <exec/types.h>
  14. #endif
  15.  
  16. #ifndef INTUITION_INTUITION_H
  17. #include <intuition/intuition.h>
  18. #endif
  19.  
  20.  
  21. #define INTERNATIONAL
  22.  
  23. /*
  24.  * ID's for gadget Styles:
  25.  */
  26.  
  27. #define Button_ID       0           /* Standard button */
  28. #define Toggle_ID       1           /* Toggling button - not recommended */
  29. #define String_ID       2           /* String gadget */
  30. #define Integer_ID      3           /* Integer gadget */
  31. #define HSlider_ID      4           /* Horizontal slider */
  32. #define VSlider_ID      5           /* Vertical slider */
  33. #define Cycle_ID        6           /* 2.0-style cycler */
  34. #define Check_ID        7           /* 2.0-style checkbox */
  35. #define MX_ID           8           /* 2.0-style MX */
  36.  
  37. #define Border_ID       10          /* Bevel box border */
  38. #define Text_ID         11          /* Text */
  39. #define Image_ID        12          /* struct Image */
  40.  
  41. #define Up_ID           13          /* Up button */
  42. #define Down_ID         14          /* Down button */
  43.  
  44. #define QButton_ID      20          /* Button with no image */
  45. #define QToggle_ID      21          /* Toggler with no image */
  46. #define QString_ID      22          /* String with no image */
  47. #define QInteger_ID     23          /* Integer with no image */
  48. #define QHSlider_ID     24          /* HSlider with no image */
  49. #define QVSlider_ID     25          /* VSlider with no image */
  50. #define QCycle_ID       26          /* Cycler with no image */
  51. #define QCheck_ID       27          /* Checkbox with no image */
  52. #define QMX_ID          28          /* MX with no image */
  53.  
  54. #define Ignore_ID       100         /* Ignore this item - not implemented */
  55.  
  56. #define Font_ID         252         /* internal use only */
  57. #define Offset_ID       253         /* internal use only */
  58. #define Scale_ID        254         /* internal use only */
  59.  
  60. #define End_ID          255
  61.  
  62. /*
  63.  * GedGadget - Internal use by the gadget maintenance routines.
  64.  *             All fields should be considered READ ONLY and
  65.  *             are subject to change without notice.
  66.  *
  67.  *             About the only thing you might be interested in
  68.  *             is the "CycleArray" field; it allows you to
  69.  *             change the list of labels for a cycle gadget
  70.  *             at will by simply changing pointers.  You get
  71.  *             a pointer to the GedGadget structure by
  72.  *             casting the Gadget pointers returned by Ged_Create().
  73.  *             Eg:
  74.  *                   gedgad = (struct GedGadget *)gad;
  75.  *
  76.  */
  77.  
  78. struct GedGadget {
  79.    struct Gadget  Gadget;           /* Regular Gadget */
  80.    struct Border *PropBorder;       /* Prop border */
  81.    long           Lowest, Highest;  /* Range of slider or integer */
  82.    int          (*Code)(struct Window *, struct Gadget *, ULONG, ...);
  83.                                     /* User code */
  84.    ULONG          UserData;         /* User data */
  85.    short          Style;            /* Gadget style */
  86.    char           Shortcut;         /* Keyboard shortcut (no qualifier) */
  87.    char           Selected;         /* Checkbox selected? */
  88.    char         **CycleText;        /* Complete language text array */
  89.    long          *CycleArray;       /* Array of text indexes... */
  90.    short          CycleIndex;       /* Index into cycle array */
  91.    ULONG         *Pointer;          /* Gadget state storage */
  92.    struct NewGad *NewGad;           /* NewGad from which we came */
  93.    short          NextActive;       /* GadgetID to activate next */
  94.    short          ReturnCode;       /* Button return code */
  95.    short         *MXArray;          /* Mutual exclusion array - unused for now */
  96.    char           RightAmiga;       /* RightAmiga key shortcut */
  97. };
  98.  
  99. /*
  100.  * NewGad - You fill in an array of these to define what gadgets,
  101.  *          text, borders, and images that you want for your window.
  102.  *          End the list with an element of style End_ID.
  103.  */
  104.  
  105. struct NewGad {
  106.    short          Style;            /* Style - What this array element
  107.                                      *    actually is.  Can be a gadget,
  108.                                      *    text, border, or image.  See
  109.                                      *    style defines above. */
  110.    short          ID;               /* ID - For gadget styles, this is
  111.                                      *    used to reference the gadget
  112.                                      *    in most of the maintenance
  113.                                      *    functions. */
  114.    short          LE, TE, W, H;     /* Position - This defines the
  115.                                      *    absolute location of the item.
  116.                                      *    For text and images, only the
  117.                                      *    LE and TE fields are actually
  118.                                      *    used. */
  119.    long           Label;            /* Indicates the index into a char **
  120.                                      *    array to use as the text label
  121.                                      *    for this item.  The text array
  122.                                      *    is passed to the Ged_Create()
  123.                                      *    function.  Used this way to
  124.                                      *    make internationalizing easier.
  125.                                      *    Alternately, if the text array
  126.                                      *    passed to Ged_Create() is NULL,
  127.                                      *    then this field is taken to be
  128.                                      *    a simple pointer to a string.
  129.                                      */
  130.    int          (*Code)();          /* Code - for gadgets, this defines
  131.                                      *    the function to call whenever
  132.                                      *    this gadget is "played" with.
  133.                                      *    The function will be passed
  134.                                      *    the current value of the gadget
  135.                                      *    (for string, integer, props, etc.)
  136.                                      *    See below for the function
  137.                                      *    prototypes for each of the styles
  138.                                      *    of gadgets.  Use NULL if no
  139.                                      *    function is needed.
  140.                                      */
  141.    ULONG          UserData;         /* UserData - passed to the function
  142.                                      *    above unchanged; you can use
  143.                                      *    this for whatever you want.
  144.                                      */
  145.    ULONG         *Pointer;          /* Points to a place to store the
  146.                                      *    current "value" of this gadget
  147.                                      *    (if the item *is* a gadget).
  148.                                      *    For example, the current value
  149.                                      *    of a slider could be stored here
  150.                                      *    so you only need to reference a
  151.                                      *    single global variable instead
  152.                                      *    of retreiving the value from
  153.                                      *    the gadget all the time.
  154.                                      */
  155.    /* Following entires vary from style to style: */
  156.    long           Data1;            /* These represent various parameters */
  157.    long           Data2;            /*    for the various styles. */
  158.    long           Data3;            /*    They are detailed below. */
  159.    long           Data4;
  160.    long           Data5;
  161.    long           Data6;
  162.    long           Data7;
  163.    long           Data8;
  164. };
  165.  
  166. /*
  167.  * Data#? Descriptions:
  168.  *
  169.  *
  170.  * Button_ID:
  171.  *
  172.  *    Data1    (long) Value to return to caller of GedWindow.  Use
  173.  *             non-zero to exit a GedWindow.
  174.  *    Data2    (char) Keyboard shortcut character, NUL for none.
  175.  *    Data3    (struct Image *) Image to use for this gadget instead
  176.  *             of the standard bevel button imagery.
  177.  *
  178.  * Toggle_ID:
  179.  *
  180.  *    Data1    (long) Select state; non-zero to initially select.
  181.  *    Data2    (char) Keyboard shortcut character, NUL for none.
  182.  *    Data3    (struct Image *) Image to use for this gadget instead
  183.  *             of the standard bevel button imagery.
  184.  *
  185.  * Integer_ID:
  186.  *
  187.  *    Data1    (long) Highest value for gadget (currently ignored).
  188.  *    Data2    (long) Initial value.
  189.  *    Data3    (long) Lowest value for gadget (current ignored).
  190.  *    Data4    (long) ID of next gadget to activate.
  191.  *    Data5    (long) 0 == left, 1 == right, 2 == center
  192.  *
  193.  * String_ID:
  194.  *
  195.  *    Data1    (long) Maximum characters in string buffer.
  196.  *    Data2    (char *) Initial string for the gadget.
  197.  *    Data4    (long) ID of next gadget to activate.
  198.  *    Data5    (long) 0 == left, 1 == right, 2 == center
  199.  *
  200.  * Slider_ID:
  201.  *
  202.  *    Data1    (long) Highest value of slider.
  203.  *    Data2    (long) Initial value of the slider.
  204.  *    Data3    (long) Lowest value of slider.
  205.  *    Data6    (struct Image *) Image to use for slider knob.
  206.  *
  207.  * Cycle_ID:
  208.  *
  209.  *    Data1    (long *) Array of gadget labels, each entry is an
  210.  *             index into the char ** text array given to
  211.  *             Ged_Create().
  212.  *    Data2    (char) Keyboard shortcut character, NUL for none.
  213.  *    Data4    (long) Initial element of cycle array to be shown.
  214.  *    Data7    (char **) Text array to override the array passed
  215.  *             to the Ged_Create() function.
  216.  *
  217.  * Check_ID:
  218.  *
  219.  *    Data1    (long) Select state; non-zero to initially select.
  220.  *    Data2    (char) Keyboard shortcut character, NUL for none.
  221.  *
  222.  * MX_ID:
  223.  *
  224.  *    Data1    (long) Select state; non-zero to initially select.
  225.  *    Data2    (char) Keyboard shortcut character, NUL for none.
  226.  *
  227.  * Border_ID:
  228.  *
  229.  *    Data1    (long) Non-zero for recessed border, otherwise raised.
  230.  *    Data2    (long) Non-zero for double-thick border.
  231.  *
  232.  * Text_ID:
  233.  *
  234.  *    Data1    (long) Pen number to draw text with.
  235.  *    Data3    (long) 0 = newgad->LE is the left edge of text;
  236.  *                    1 = newgad->LE indicates the RIGHT edge of the text;
  237.  *                    2 = newgad->LE indicates the CENTER of the text.
  238.  *
  239.  */
  240.  
  241. /*
  242.  *  These are to allow easy creation of gadget function prototypes:
  243.  *
  244.  *  For example:
  245.  *
  246.  *  int SaveCode (GedButtonProto)
  247.  *  {
  248.  *     return(0);
  249.  *  }
  250.  */
  251.  
  252. #define GedButtonProto  struct Window *w, struct Gadget *g, ULONG ud
  253. #define GedToggleProto  struct Window *w, struct Gadget *g, ULONG ud, long val
  254. #define GedStringProto  struct Window *w, struct Gadget *g, ULONG ud, char *text
  255. #define GedIntegerProto struct Window *w, struct Gadget *g, ULONG ud, long val
  256. #define GedSliderProto  struct Window *w, struct Gadget *g, ULONG ud, long val, BOOL moving
  257. #define GedCycleProto   struct Window *w, struct Gadget *g, ULONG ud, long idx
  258. #define GedCheckProto   struct Window *w, struct Gadget *g, ULONG ud, long val
  259. #define GedMXProto      struct Window *w, struct Gadget *g, ULONG ud, long val
  260.  
  261. /* Ancient compatibility - do not use: */
  262. #define Reserved1    Data5
  263. #define Reserved2    Data6
  264. #define Reserved3    Data7
  265. #define Reserved4    Data8
  266.  
  267. /* So we don't have to refer to `Data1', etc. */
  268. #define ng_RC        Data1
  269. #define ng_Key       Data2
  270. #define ng_Image     Data3
  271. #define ng_Select    Data1
  272. #define ng_Highest   Data1
  273. #define ng_Integer   Data2
  274. #define ng_Lowest    Data3
  275. #define ng_Next      Data4
  276. #define ng_MaxChars  Data1
  277. #define ng_String    Data2
  278. #define ng_Initial   Data2
  279. #define ng_Labels    Data1
  280. #define ng_Index     Data4
  281. #define ng_Exclude   Data3
  282.  
  283. /*
  284.  * GedContext - used to keep context information about a list of
  285.  *              NewGad's after they're created.  Should be considered
  286.  *              READ ONLY, and is subject to change without notice.
  287.  */
  288.  
  289. struct GedContext {
  290.    struct Gadget    *GadList;       /* Gadget List */
  291.    struct IntuiText *ITextList;     /* IntuiText List */
  292.    struct Border    *BorderList;    /* Border List */
  293.    struct Image     *ImageList;     /* Image List */
  294.    char            **TextArray;     /* Text array */
  295.    short             NumGads;       /* Number of gadgets */
  296.    short             Reserved1;
  297.    long              Reserved2[8];
  298. };
  299.  
  300. #ifdef SCANPRIVATE
  301. /*
  302.  * Private, do not touch:
  303.  */
  304.  
  305. extern int        (*GedPostGadHook)(struct Window *win);
  306. extern int        (*GedPreGadHook)(struct Window *win);
  307.  
  308. extern UWORD      GedSourceWid, GedSourceHt,
  309.                   GedDestWid, GedDestHt;
  310. extern WORD       GedLeftOffset, GedTopOffset;
  311. #endif
  312.  
  313.  
  314. #define SCAN_GED_H
  315. #endif
  316.